import java.util.Scanner;

public class Person {
    public String sex;
    public void setSex(String sex)throws demo9{
        if ("男".equals(sex)||"女".equals(sex)){
            this.sex=sex;
        }
        else {
            throw new demo9("性别必须是男或者女");
        }
    }
}
class TestPerson{
    public static void main(String[] args) {
        Person person=new Person();
        try {
            person.setSex("Male");
        } catch (demo9 e) {
            e.printStackTrace();
        }
    }}

